package TeacherLegendAPI.String;

public class StringBuilderDemo {
    public static void main(String[] args) {
        String str="好好学习Java";
        StringBuilder builder=new StringBuilder(str);
        System.out.println(str);//好好学习Java
        System.out.println(builder);//好好学习Java

        builder.append(",就是为了找个好工作!");
        System.out.println(builder);//好好学习Java,就是为了找个好工作!

        builder.replace(9,18,"就是为了改变世界");
        System.out.println(builder);//好好学习Java,就是为了改变世界!

        builder.delete(0,8);
        System.out.println(builder);//,就是为了改变世界!

        builder.insert(0,"活着");
        System.out.println(builder);//活着,就是为了改变世界!

        str=builder.toString();
    }
}
